<%@ page language="java" contentType="text/html;charset=UTF-8"
	pageEncoding="UTF-8"%>
<%--<%@ include file="/inc/loginCheck.jsp" %>--%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="/WEB-INF/orgtree.tld" prefix="oo"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%> 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <%
     String relevantDataId=request.getParameter("relevantDataId")==null?"principalid":request.getParameter("relevantDataId");
     String relevantDataName=request.getParameter("relevantDataName")==null?"principal":request.getParameter("relevantDataName");
    %>
    
    <title>My JSP 'testiframe.jsp' starting page</title>
    <link rel="stylesheet" type="text/css" href="<%=path%>/css/newPage.css">
    <script type="text/javascript">
	
		function setOpener(){
		
		    var obj2 = document.getElementById('form1:hiddenIds').value;
	   		if(obj2.indexOf("U")>=0)
	   		{
	   			alert("请选择人员！！");
	   		}
	   		else if(obj2.indexOf("R")>=0)
	   		{
	   			alert("请选择人员！！");
	   		}else
	   		{
	   			opener.document.getElementById('<%=relevantDataId%>').value=document.getElementById('form1:hiddenIds').value;
		 		if(opener.document.getElementById('<%=relevantDataName%>').value!=null)
		 		{
				opener.document.getElementById('<%=relevantDataName%>').value=document.getElementById('form1:hiddenNames').value;
	  	 	   }	
	  		   if(opener.document.getElementById('<%=relevantDataName%>').value==null || opener.document.getElementById('<%=relevantDataName%>').value==null)
	  		   {
	    		if(confirm("您确定您的操作吗？"))
	    		{
		   		 //opener.document.form1.submit();
	    		}
	    	   }	
	   		}
	   		window.opener=null;
			window.close();
		}
	
	</script>
    <oo:treeScriptIndex formName="form1" hiddenIds="hiddenIds" useIds="true" hiddenNames="hiddenNames" useNames="true"/>
  </head>
  
  <body topmargin=0 leftmargin=0 rightmargin=0 bottommargin=0>
  <f:view>   
  <h:form id="form1">
  <f:loadBundle basename="com.synchroflow.frame.admin.resource.LocalStrings" var="msg"/>
      <table width="102%" cellpadding="0" cellspacing="0" border="0">
		<tr height="25"><td background="<%=path%>/images/top01.gif"></td></tr>
		</table>
			<br>
		
		<table width="90%" align="center" cellpadding="0" cellspacing="0">
		<tr><td><h:outputText value="#{msg.can}" styleClass="pageTitle"/></td></tr>
	  	
	  	<tr height="15">
	    <td background="<%=path%>/images/line01.gif">
	    </td>
	  	</tr>
    	</table>

    <TABLE width="90%" align="center">
    <TR>
    <TD><iframe id="treeframe" name="tree" src="orgTreeServlet?trace=o/1&amp;iframe=/application/projectrfps/commonUser/iforgtree.jsp" style="height:300;width=240"></iframe></TD>
    <TD>
	    &nbsp;&nbsp;<h:commandButton type="button" value="#{msg.add_bu}" onclick="add_select()" styleClass="buttonStyle"/>&nbsp;&nbsp;<br><br>
	    &nbsp;&nbsp;<h:commandButton type="button" value="#{msg.delete_bu}" onclick="delete_choose()" styleClass="buttonStyle"/>&nbsp;&nbsp;<br><br>
	    &nbsp;&nbsp;<h:commandButton type="button" value="#{msg.delete_all}" onclick="delete_all()" styleClass="buttonStyle"/>&nbsp;&nbsp;
    </TD>
    <TD>
    <select multiple="true" size="20" id="mulbox" name="mulsel" style="width:145px;height:310px">
    </select>
    </TD>
    </TR>
    </TABLE>
	  <table width="90%" align="center" cellpadding="0" cellspacing="0">
	  	<tr height="15">
	    <td background="<%=path%>/images/line02.gif">
	    </td>
	  	</tr>
		</table>
	  <br>

	 <table width="90%" align="center" cellpadding="0" cellspacing="0">
		  <tr>
			  <td align="right">
			    <h:inputText id="hiddenIds" value="#{treeManagerBean.participantStr}" style="display:none"/>
			    <h:inputText id="hiddenNames" value="#{treeManagerBean.participantStr}" style="display:none"/>
			    <h:commandButton value="#{msg.save}" styleClass="buttonStyle" action="closesuccess" onclick="setHidderStr();setOpener();if(1==1){return false;}"/>&nbsp;&nbsp;&nbsp;&nbsp;
		     </td>
		 </tr>
	 </table>
	 </h:form>
	 </f:view>
  </body>
</html>
